<?php

class TaggedModel extends Model
{
    /**
     * 通过拼音获取文章ID
     *
     * @param $pinyin 标签的拼音
     * @return array　文章ID
     */
    public function getArticleIdByTag($pinyin)
    {
        $tag = D('Tag')->getTagByPinYin($pinyin);

        $article_id = $this->where('tag_id=' . $tag['id'])->select();
        $arr = array();
        foreach ($article_id as $value) {
            $arr[] = $value['article_id'];
        }

        return $arr;
    }
}